<?php
class mySQL
{		
	/*
	*	Makes a MySQL Query
	*
	*/
	public function makeQuery($query="")
	{	
		if(TRUE == empty($query))
		{
			unset($query);
		}
		if(FALSE != strstr($query, "DROP"))
		{
			unset($query);
		}
		if(FALSE != strstr($query, "TRUNCATE"))
		{
			unset($query);
		}
		if($query)
		{
			$result = mysqli_query($this->Connection,$query);
			$this->arrError[] = mysqli_error($this->Connection);
			return $result;
		}
	}
	
	/*
	*	List all the MySQL Errors
	*
	*/
	public function listErrors()
	{
		if($this->arrError)
		{
			foreach( $this->arrError as $key => $value)
			{
				if(!EMPTY($value))
				{
					echo $value . "<br>";
				}
			}
			return false;
		}
		else
		{
			return true;
		}
	}
	
	public function insertID()
	{
		return mysqli_insert_id($this->Connection);
	}
	/*
	*	Connects to the MySQL Server as defined in the Settings.class.php
	*
	*/
	public function connectDB()
	{
		$this->Connection = mysqli_connect(DATABASE_LOCATION, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME) or die("Failed");
		$this->arrError[] = mysqli_error($this->Connection);
	}
}
?>